package com.weixin.paleituo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.base.BaseRecycleAdapter;
import com.weixin.paleituo.help.RecycleViewHolder;

import java.util.List;

/**
 * Author yichao
 * Time  2018/6/28 14:21
 * Dest  选择楼栋
 */

public class SelectBuildingRecyclerViewAdapter  extends BaseRecycleAdapter<String> {

    public SelectBuildingRecyclerViewAdapter(Context context, List<String> datas) {
        super(context, datas, R.layout.item_building_layout);
    }

    @Override
    protected void setData(RecycleViewHolder holder, String s, final int position) {
        TextView tvname = holder.getItemView(R.id.tv_building_item_building_layout);
        tvname.setText(s);
        tvname.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mOnListener!=null){
                    mOnListener.onItemOnClick(position);
                }
            }
        });

    }
    OnListener mOnListener;
    public interface  OnListener{
        void onItemOnClick(int position);
    }
    public void setOnListener(OnListener onListener){
        this.mOnListener=onListener;

    }
}
